package com.effectiv.gooruda.rest.api.operation;

import javax.ws.rs.core.MediaType;

import com.effectiv.gooruda.rest.api.domain.Permission;
import com.effectiv.gooruda.rest.docs.core.annotation.Api;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiBodyObject;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiHeader;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiHeaders;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiMethod;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiParam;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiResponseObject;
import com.effectiv.gooruda.rest.docs.core.pojo.ApiVerb;

@Api(name = "Permission API", description = "Permission management API.")
public interface PermissionOperations {
	@ApiMethod(path = "/api/permission", verb = ApiVerb.POST, description = "Save permission details.", 
			produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@ApiResponseObject
	Permission create(@ApiBodyObject Permission p);
	
	@ApiMethod(path = "/api/permission/findbyname/{name}", verb = ApiVerb.GET, 
			description = "Retrieves permission details by name.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })	
	@ApiResponseObject
	Permission findByName(@ApiParam(name = "name", required = true, description = "Permission name.") String name);
	
	@ApiMethod(path = "/api/permission/findone/{id}", verb = ApiVerb.GET, 
			description = "Retrieves the details of an user by id.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })	
	@ApiResponseObject
	Permission findOne(@ApiParam(name = "id", required = true, description = "Permission id.") String id);
}
